import React, { useState } from 'react';
import Casting from './components/Casting';
import CastingDetail from './components/CastingDetail';

export default () => {
  // 控制是否展示详情组件
  const [isLoadCastingDetail, setIsLoadCastingDetail] = useState(false);
  // 详情信息
  const [positionInfo, setPositionInfo] = useState({});

  return (
    <div>
      {/* CastingDetail组件 Casting铸造组件*/}
      {isLoadCastingDetail ? (
        <CastingDetail
          positionInfo={positionInfo}
          setIsLoadCastingDetail={setIsLoadCastingDetail}
        ></CastingDetail>
      ) : (
        <Casting
          setIsLoadCastingDetail={setIsLoadCastingDetail}
          setPositionInfo={setPositionInfo}
        ></Casting>
      )}
    </div>
  );
};
